<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <include file="Pub:head" />
    <link rel="stylesheet" href="__PUBLIC__/kindeditor/themes/default/default.css" />
    <script charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor-min.js"></script>
    <script charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
    <script>
        $(function(){
            var editor;
            KindEditor.ready(function(K) {
                editor = K.create('textarea[name="note"]', {
                    allowFileManager : true,
                    autoHeightMode : true,
                    afterCreate : function() {
                        this.loadPlugin('autoheight');
                    }
                });
            });
        })

    </script>
</head>
<body>

<div class="box1">

    <legend>工序分配</legend>
    <form action="__URL__/addtask" method="post">
        <table class="tableStyle">

            <tr>
                <td>网站名：</td>
                <td >
                    <input type="text" name="name" id="taskname" value="{$taskinfo['name']}" style="width:200px"/>
                    <input type="hidden" name="projectid" value="{$taskinfo['projectid']}">
                    <input type="hidden" name="site" value="{$taskinfo['id']}">
                    <input type="hidden" name="parentid" value="{$taskinfo['id']}">
                </td>
            </tr>
            <tr>
                <td>任务类型：</td>
                <td  >
                    <select name="type" size="1" id="tasktype" onChange='setdealine();'>
                        <option>-请选择-</option>
                        <volist name="list" id="vo">
                            <option value="{$vo['id']}" time1="{$vo['time']}">{$vo['name']}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <td>任务顺序：</td>
                <td >
                    <input type="text" name="orders" value="1"/>
                </td>
            </tr>
            <tr>
                <td>工期：</td>
                <td >
                    <input type="text" name="deadline" id="deadline" value="{$defaulttime}"/>
                </td>
            </tr>

            <tr>
                <td>网站资料</td>
                <td ><textarea name="note" style="width:800px;height:400px;visibility:hidden;">{$taskinfo['note']}</textarea></td>
            </tr>

            <tr>
                <td colspan="2"><input type="submit" value="创建"/></td>
            </tr>
        </table>
    </form>


    <script language="javascript" type="text/javascript">

        function setdealine() {
            // var tasktime=$("tasktype").find("option:selected").attr("time1");
            var tasktime = $("#tasktype").find("option:selected").attr("time1");
            tasktime = parseInt(tasktime);

            var today = new Date();
            today.setDate(today.getDate() + tasktime);
            var datestr = fundata(today);

           // $("#deadline").val(datestr);
            $("#deadline").val(tasktime);

            var taskname=$("#tasktype").find("option:selected").text();
            $("#taskname").val( $("#taskname").val()+"-" +taskname);
        }

        function fundata(myDate) {
            var mystr = "";
            mystr = myDate.getFullYear() + "-";
            var month = myDate.getMonth() + 1;
            mystr += month + "-";
            mystr += myDate.getDate() + " ";
            mystr += myDate.getHours() + "-";
            mystr += myDate.getMinutes() + "-";
            mystr += myDate.getSeconds();

            return mystr;
        }
    </script>
</div>
</body>
</html>